-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 16277 #16716
Issue 16277 #16716
Conversation
Fix error 500
Fixed code typo
Fixed Python2 support :( (urllib.error) |
Please check again "do-not-merge" label cc/ @dstftw |
¿Por qué no lo implementan en las nuevas versiones? Funciona perfecto desde el repositorio de @Nekmo |
youtube_dl/extractor/atresplayer.py
Outdated
try: | ||
from urllib.error import HTTPError | ||
except ImportError: | ||
from urllib2 import HTTPError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compat_HTTPError
.
youtube_dl/extractor/atresplayer.py
Outdated
|
||
class AtresPlayerIE(InfoExtractor): | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html' | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/' \ | ||
r'[^/]+/[^/]+/[^/_]+_(?P<id>[A-z0-9]+)/?' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/?
is pointless at the end.
youtube_dl/extractor/atresplayer.py
Outdated
|
||
class AtresPlayerIE(InfoExtractor): | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html' | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/' \ | ||
r'[^/]+/[^/]+/[^/_]+_(?P<id>[A-z0-9]+)/?' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the regex on a single line.
youtube_dl/extractor/atresplayer.py
Outdated
|
||
class AtresPlayerIE(InfoExtractor): | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html' | ||
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/[^/]+/[^/]+/' \ | ||
r'[^/]+/[^/]+/[^/_]+_(?P<id>[A-z0-9]+)/?' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A-z
incorrect.
youtube_dl/extractor/atresplayer.py
Outdated
_NETRC_MACHINE = 'atresplayer' | ||
_TESTS = [ | ||
{ | ||
'url': 'http://www.atresplayer.com/television/programas/el-club-de-la-comedia/temporada-4/capitulo-10-especial-solidario-nochebuena_2014122100174.html', | ||
'md5': 'efd56753cda1bb64df52a3074f62e38a', | ||
'url': 'https://www.atresplayer.com/lasexta/programas/el-' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't split. Same everywhere.
} | ||
|
||
self._download_webpage(self._LOGIN_URL, None, 'get login page') | ||
request = sanitized_Request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline into actual _download_*
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nekmo You can make json POST with _download_json
, and set expected statuses
for POST use data=urlencode_postdata(form_data)
From common.py
def _download_json(
self, url_or_request, video_id, note='Downloading JSON metadata',
errnote='Unable to download JSON metadata', transform_source=None,
fatal=True, encoding=None, data=None, headers={}, query={},
expected_status=None):
"""
Return the JSON object as a dict.
See _download_webpage docstring for arguments specification.
"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response from the server is not a json. This request is to set cookies and session.
youtube_dl/extractor/atresplayer.py
Outdated
except JSONDecodeError: | ||
return original_exception | ||
if isinstance(data, dict) and 'error' in data: | ||
return ExtractorError('{} returned error: {} ({})'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No {}
.
youtube_dl/extractor/atresplayer.py
Outdated
raise self._atres_player_error(e.exc_info[1].file.read(), e) | ||
|
||
for source in video_data['sources']: | ||
if source['type'] == "application/dash+xml": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single quotes.
youtube_dl/extractor/atresplayer.py
Outdated
raise self._atres_player_error(e.exc_info[1].file.read(), e) | ||
|
||
for source in video_data['sources']: | ||
if source['type'] == "application/dash+xml": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not break if no type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eg find type by URL ext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed on PR bbb857c
youtube_dl/extractor/atresplayer.py
Outdated
'thumbnail': thumbnail, | ||
'duration': duration, | ||
'title': video_data['titulo'], | ||
'description': video_data['descripcion'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read coding conventions on optional/mandatory meta fields.
FWIW, this is working fine locally, on both Windows 10 (Python 3.7.3) and Debian stable (Python 3.5.3). It does not work, however, on an Ubuntu 16.04 instance that I have in DigitalOcean (Python 3.5.2). I guess it may be because of IP address-based geo-blocking? I am getting an HTTP 403:
|
At least skimmed through adding new extractor tutorial and youtube-dl coding conventions sections
Searched the bugtracker for similar pull requests
Checked the code with flake8
I am the original author of this code and I am willing to release it under Unlicense
Bug fix
Fixed Issue #16277: Atresplayer broken: ERROR: Unsupported URL